#include<stdio.h>
#include<math.h>
int main()
{
	int sign=1;
	int count=0;
	double term=1.0,n=1.0,pi=0;
	while(fabs(term)>1e-8)
	{
		pi=pi+term;
		n=n+2;
		sign=-sign;
		term=sign/n;
		count++;
	}
	pi=4*pi;
	printf("pi=%10.8f\n",pi);
	printf("count=%d\n",count);
	return 0;
 } 
